{{ extend './common/layout.html' }}

{{ block 'css' }}
<link rel="stylesheet" href="/static/home/css/index.css">
{{ /block }}

{{ block 'main' }}
<!-- 文章列表开始 -->
<ul class="list w1100">
	{{ each records v i }}
	<li class="{{ i % 2 === 0 ? 'fl' : 'fr' }}">
		<a href="/home/article/{{ v._id + '' }}" class="thumbnail">
			<img src="/static/uploads/{{ v.cover.split(',')[0] }}">
		</a>
		<div class="content">
			<a class="article-title" href="/home/article/{{ v._id + '' }}">{{ v.title }}</a>
			<div class="article-info">
				<span class="author">{{ v.author.uname }}</span>
				<span>{{ dateformat(v.publishDate, 'yyyy-mm-dd') }}</span>
			</div>
			<div class="brief">
				{{ v.content.replace(/<[^>]+>/g, '') }}
			</div>
		</div>
	</li>
	{{ /each }}
</ul>
<!-- 文章列表结束 -->

<!-- 分页开始 -->
<div class="page w1100">
	{{ if page > 1 }}
	<a href="/home?page={{ page - 1 }}">上一页</a>
	{{ /if }}

	{{ each display v }}
	<a href="/home?page={{ v }}" class="{{ page === v ? 'active' : '' }}">{{ v }}</a>
	{{ /each }}

	{{ if page < pages }}
	<a href="/home?page={{ page + 1 }}">下一页</a>
	{{ /if }}
</div>
<!-- 分页结束 -->
{{ /block }}